﻿using UnityEngine;
using System.Collections;

public class AlphaBlink : MonoBehaviour
{
	void OnEnable()
	{
		StartCoroutine(Blink ());
	}

	IEnumerator Blink()
	{
		SpriteRenderer rend	= (SpriteRenderer)renderer;
		Color color			= rend.color;

		while(true)
		{
			color.a			= 0.5f;
			rend.color		= color;

			yield return new WaitForSeconds(0.3f);

			color.a			= 1f;
			rend.color		= color;

			yield return new WaitForSeconds(0.3f);
		}
	}
}
